package org.urchr.beorganized.api.impl;

import org.urchr.beorganized.api.base.PrivateBaseAPIServlet;
import org.urchr.beorganized.dao.NotesDAO;
import org.urchr.beorganized.dao.errors.GeneralException;

public class LoadTree extends PrivateBaseAPIServlet {

	public LoadTree() {
		skipBody = true;
	}
	
	@Override
	protected void doProcessPrivate() throws GeneralException {
		int noteID = NotesDAO.safeInt(request.getParameter("noteid"), -1);
		boolean loadData = "true".equals(request.getParameter("loaddata"));
		boolean loadChildren = !"false".equals(request.getParameter("loadchildren"));
		sendNode(NotesDAO.getTree(noteID, userID, loadData, loadChildren));
	}

}
